package com.sz.jinzheng.service.impl;

import com.sz.jinzheng.mapper.TbillFormMapper;
import com.sz.jinzheng.model.BillForm;
import com.sz.jinzheng.model.Interest;
import com.sz.jinzheng.service.TbillFormService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class TbillFormSericeImp implements TbillFormService {
    @Autowired
    private TbillFormMapper tbillFormMapper;//从SPring容器中取出mapper方法

    @Override
    public BillForm getAllRepayment(BillForm billForm) {
        return tbillFormMapper.getAllRepayment(billForm);//通过id查询
    }

    //    public  BillForm getInterest(Integer id) {//通过ID查询用户选择的还款方式
//        return tbillFormMapper.getInterest(id);
//    }
    public Interest getInterest(Integer id) {
        return tbillFormMapper.getInterest(id);
    }
    public BillForm overtime(Integer id) {//查询是否逾期和逾期后的违约率;
        return tbillFormMapper.overtime(id);
    }



    @Override
    public int insertbill(BillForm billForm) {
        return tbillFormMapper.insertbill(billForm);
    }

    @Override
    public List<BillForm> getArrears(Integer borrowInfoId, Integer status, Integer isDeleted) {
        return tbillFormMapper.getArrears(borrowInfoId,status,isDeleted);
    }

    @Override
    public int updateForm(Integer borrowInfoId,Integer whichIssue) {//修改账单
        return tbillFormMapper.updateForm(borrowInfoId,whichIssue);
    }
    @Override
    public int updateFormOverdue(Integer id,Integer status,Integer overdueDays,Double penaltyInterest) {//修改账单状态为逾期
        return tbillFormMapper.updateFormOverdue(id,status,overdueDays,penaltyInterest);
    }

    @Override
    public BillForm timePayment(Integer whichIssue, Integer borrowInfoId,Integer id) {//查询账单通过当前第几期和用户id
        return tbillFormMapper.timePayment(whichIssue,borrowInfoId,id);
    }

    @Override
    public BillForm getzhangdan(Integer id, Integer whichIssue) {
        return tbillFormMapper.getzhangdan(id,whichIssue);
    }

    @Override
    public int ModifyAllBills(Integer borrowInfoId) {
       return   tbillFormMapper.ModifyAllBills(borrowInfoId);
    }
}
